package com.lontyu.jsoup.controller;

import com.lontyu.jsoup.entity.Book;
import com.lontyu.jsoup.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: xzj
 * @Dscription：
 * @Date: Created by 17:06 2018/9/13
 */
@Controller
public class TestController {

    @Autowired
    IBookService bookService;

    @RequestMapping("/test")
    @ResponseBody
    public String test(){
        List<Book> list = new ArrayList<>();
        list.add(new Book("test01", BigDecimal.valueOf(18),"1"));
        list.add(new Book("test02", BigDecimal.valueOf(9),"3"));
        list.add(new Book("test03", BigDecimal.valueOf(19),"2"));
        boolean flag = bookService.batchInsertBooks(list);
        return String.valueOf(flag);
    }
}
